#!/bin/bash
set -ex
BUILDING_PRODUCT=auth ./build-scripts/jenkins-driver
./bootstrap
CC="ccache gcc" CXX="ccache g++" ./configure --with-modules='gmysql gpgsql gsqlite3 ldap lua mydns opendbx pipe remote tinydns random '$([ -d modules/bindbackend ] && echo bind) --enable-remotebackend-http --enable-unit-tests
make dist
#cd pdns; ./dist-recursor; cd ..
make -j4
make -C pdns pdns_server
make -C pdns dnsbulktest
#make -C pdns/docs all
make -C codedocs codedocs
if [ -d modules/bindbackend ] ; then make -C pdns zone2sql zone2ldap zone2json ; else make -C pdns/backends/bind zone2sql zone2ldap zone2json ; fi
tar cjf codedocs.tar.bz2 codedocs/html
make -C pdns $(grep '(EXEEXT):' pdns/Makefile | cut -f1 -d\$ | grep -v zone2lmdb | grep -v calidns | grep -v dnsdist)
cd regression-tests
SRCDIR=../pdns ../pdns/testrunner --log_level=all --output_format=XML --report_level=no > boosttestresults-unit.xml
./start-test-stop 5300 bind || true
./start-test-stop 5301 bind-dnssec || true
./start-test-stop 5302 bind-dnssec-nsec3 || true
./start-test-stop 5303 bind-dnssec-nsec3-optout || true
./start-test-stop 5304 bind-dnssec-nsec3-narrow || true
./start-test-stop 5310 gmysql-nodnssec || true
./start-test-stop 5311 gmysql || true
./start-test-stop 5312 gmysql-nsec3 || true
./start-test-stop 5312 gmysql-nsec3-optout || true
./start-test-stop 5314 gmysql-nsec3-narrow || true
./start-test-stop 5320 gsqlite3-nodnssec || true
./start-test-stop 5321 gsqlite3 || true
./start-test-stop 5322 gsqlite3-nsec3 || true
./start-test-stop 5330 gpgsql-nodnssec || true
./start-test-stop 5331 gpgsql || true
./start-test-stop 5332 gpgsql-nsec3 || true
./start-test-stop 5340 tinydns || true
./start-test-stop 5350 opendbx-sqlite3 || true
./start-test-stop 5360 gmysql-nodnssec-presigned || true
./start-test-stop 5361 gmysql-presigned || true
./start-test-stop 5362 gmysql-nsec3-presigned || true
./start-test-stop 5363 gmysql-nsec3-optout-presigned || true
./start-test-stop 5370 bind-presigned || true
./start-test-stop 5371 bind-dnssec-presigned || true
./start-test-stop 5372 bind-dnssec-nsec3-presigned || true
./start-test-stop 5373 bind-dnssec-nsec3-optout-presigned || true
./start-test-stop 5380 remotebackend-unix || true
./start-test-stop 5381 remotebackend-pipe || true
#./start-test-stop 5382 remotebackend-http || true
./start-test-stop 5383 remotebackend-unix-dnssec || true
./start-test-stop 5384 remotebackend-pipe-dnssec || true
#./start-test-stop 5385 remotebackend-http-dnssec || true
./start-test-stop 5390 mydns || true
tar cf testresults-bundled.tar *.tar
cd ../regression-tests.nobackend
./runtests
